package com.phospherus.user.service

import com.phospherus.common.service.impl.BaseServiceImpl
import com.phospherus.user.entity.RoleUser
import com.phospherus.user.repository.RoleUserRepository
import org.springframework.stereotype.Service
import javax.transaction.Transactional

/**
 * @author songjinlong
 * @version 1.0
 * @since 2017/12/03
 */
@Service
@Transactional
class RoleUserService : BaseServiceImpl<RoleUser, Long, RoleUserRepository>() {
    fun deleteByRoleId(roleId: Long) =repository.deleteByRoleId(roleId)

    fun deleteByUserId(userId: Long) = repository.deleteByUserId(userId)

    fun getRoleUserByRoleIdAndUserId(roleId: Long, userId: Long) = repository.findByRoleIdAndUserId(roleId, userId)
}